<template>
  <div>
    <!-- 文章列表 -->
    <van-list
  v-model="loading"
  :finished="finished"
  finished-text="没有更多了"
  @load="onLoad"
  :immediate-check="false"
>
    <ArticleItem
    v-for="item in articleList"
        	:key="item.art_id"
        	:obj="item" 
    ></ArticleItem>
    </van-list>
  </div>
</template>

<script>
import ArticleItem from '@/views/Homes/ArtileItem.vue'
import { articlesListAPI } from '@/api'
export default {
  components: {
    ArticleItem,
},
data () {
        return {
            articleList: [],
            loading: false,
            finished: false,
            thisTime: ''
        }
      },
async created () {
            const res = await articlesListAPI({
              channelId: 0 // 默认推荐频道(id为0)
            })
            console.log(res)
            this.articleList = res.data.data.results
            this.thisTime = res.date.date.pre_timestamp
        },
        methods: {
          async onLoad () {
            const res = await articlesListAPI({
              channelId: 0 // 默认推荐频道(id为0)
            })
            console.log(res)
            this.articleList = [...this.articleList, ...res.data.data.results]
            this.thisTime = res.date.date.pre_timestamp
          }
        }
}
</script>